import request from '@/utils/request'

export function getDeptTree() {
  return request({
    url: 'api/dept/tree',
    method: 'post'
  })
}

export function page(data) {
  return request({
    url: 'api/dept/page',
    method: 'post',
    data
  })
}

export function add(data) {
  return request({
    url: 'api/dept/create',
    method: 'post',
    data
  })
}

export function del(ids) {
  const data = { ids: ids }
  return request({
    url: 'api/dept/delete',
    method: 'post',
    data
  })
}

export function edit(data) {
  return request({
    url: 'api/dept/update',
    method: 'post',
    data
  })
}

export default { add, edit, del, page, getDeptTree }
